Skip to content

Instantly share code, notes, and snippets.

@robbibt
robbibt / dea_in_r.R
Last active May 11, 2024 05:44
Loading and analysing Digital Earth Australia Sentinel-2 data in R with `rstac` and `gdalcubes`
"""
This code demonstrates how to load Digital Earth Australia Sentinel-2 Analysis Ready Data into R.
It uses `rstac` to search for available data for a time and location using DEA's STAC endpoint,
and `gdalcubes` to load and analyse the data.
Functionality includes:
* Creating a custom pixel grid to reproject data into
* Apply a cloud mask using the "s2cloudless" cloud mask
* Combine data into seasonal composites
* Create an RGB animation
@RobTrew
RobTrew / DraftsFunctions_ScriptEditor.js
Last active May 11, 2024 05:43
OS X 10.10 (Yosemite) definitions of the basic script editing functions used in iOS Drafts 4
// Ver 0.4 Rob Trew
// Library for using OSX Yosemite Script Editor scripts
// written in an idiom compatible with FoldingText, Drafts, 1Writer, TextWell
// In iOS Drafts 4 scripts, the header is simply:
// var drafts = this;
// For headers for FoldingText and other editors, see:
// See: http://support.foldingtext.com/t/writing-scripts-which-run-on-both-foldingtext-and-ios-drafts-4/652/7
// Call functions, after this header, with the prefix:
// drafts.
@gurisko
gurisko / functionName.js
Last active May 11, 2024 05:41
[NodeJS] Get the current function name or any other function while using strict mode
'use strict';
const findFirstOccurrence = (string, searchElements, fromIndex = 0) => {
let min = string.length;
for (let i = 0; i < searchElements.length; i += 1) {
const occ = string.indexOf(searchElements[i], fromIndex);
if (occ !== -1 && occ < min) {
min = occ;
}
}
@blixt
blixt / logger_middleware.go
Last active May 11, 2024 05:40
Logger middleware for Go HTTP servers which logs every request with response status code in the Apache format.
package main
import (
"fmt"
"io"
"log"
"net/http"
"os"
"time"
)
@kennypete
kennypete / navigating_the_modes_of_Vim.md
Created April 18, 2024 20:46
Navigating the modes of Vim

Navigating the modes of Vim

This diagram illustrates navigating through Vim’s modes. It was built factoring Vim 9 (i.e., all its modes, including up to two new modes, cr and cvr, in November 2023). Information about the state() and 'showmode' is provided too.

SVG version

Some features are only available in the SVG version. It is not provided directly from within this gist’s files because SVGs do not always play nicely in GitHub (particularly, refusing to display embedded fonts).

The SVG version includes hover text help, which shows pertinent information about the underlying key, command, mode, etc.

@gyopiazza
gyopiazza / schema.ts
Last active May 11, 2024 05:40
Multi-tenant with Drizzle ORM (multiple sqlite databases) - PoC
import { integer, sqliteTableCreator, text } from 'drizzle-orm/sqlite-core'
const sqliteTable = (tenant?: string) =>
sqliteTableCreator(name => (tenant ? `${tenant}_${name}` : name))
export const users = sqliteTable()('users', {
id: integer('id', { mode: 'number' }).primaryKey({ autoIncrement: true }),
name: text('name'),
})
@JBGruber
JBGruber / docker-compose.yml
Last active May 11, 2024 05:40
My compose file to run ollama and ollama-webui
services:
# ollama and API
ollama:
image: ollama/ollama:latest
container_name: ollama
pull_policy: missing
tty: true
restart: unless-stopped
# Expose Ollama API outside the container stack
@bcheck555
bcheck555 / extractAndGeotagFrames.bat
Last active May 11, 2024 05:39 — forked from Krzysiu/extractAndGeotagFrames.bat
Extract frames from video every X seconds and geotag them using GPS data file. Requires exiftool and ffmpeg. Modified to prep Insta360 video for Streetview.
@echo off
rem Updates to prep Insta360 One X2 video for Streetview upload.
rem Brian Check
rem 13 Mar 2021
rem Ksheesh Geotag Video Frames 0.0.1
rem
rem Extract frames from video every X seconds and geotag them using GPS data file.
rem Requires exiftool and ffmpeg.
@robertwahler
robertwahler / FileIO.jslib
Created April 12, 2018 13:08
UnityEngine.PlayerPrefs wrapper for WebGL LocalStorage
var FileIO = {
SaveToLocalStorage : function(key, data) {
localStorage.setItem(Pointer_stringify(key), Pointer_stringify(data));
},
LoadFromLocalStorage : function(key) {
var returnStr = localStorage.getItem(Pointer_stringify(key));
var bufferSize = lengthBytesUTF8(returnStr) + 1;
var buffer = _malloc(bufferSize);
@btoone
btoone / curl.md
Last active May 11, 2024 05:35
A curl tutorial using GitHub's API

Introduction

An introduction to curl using GitHub's API.

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin